package day7;

public class SuperMan {
    private String name;

    public void fly(Plane plane) {
        if (plane instanceof Aircraft) {
            ((Aircraft) plane).information();
            System.out.println(getName() + "驾驶客机");
            plane.start();
            plane.accelerate();
            plane.land();
        } else if (plane instanceof Fighter) {
            ((Fighter) plane).show();
            System.out.println(getName() + "驾驶战斗机");
            plane.start();
            plane.accelerate();
            ((Fighter) plane).launch();
            plane.land();
        }
    }

    public SuperMan(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

}